package com.tanhua.manage.service;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.tanhua.common.mapper.UserMapper;
import com.tanhua.common.pojo.User;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.Collection;
import java.util.List;

/**
 * @author Ling
 * @Title: null.java
 * @Package com.tanhua.manage.service
 * @Description:
 * @date 2021/9/12 20:33
 */
@Service
@Slf4j
public class UserService {

    @Autowired
    private UserMapper userMapper;


    public List<User> queryUsersByUserIdList(Collection<?> userIdList) {
        QueryWrapper<User> queryWrapper = new QueryWrapper<>();
        queryWrapper.in("id", userIdList);
        return userMapper.selectList(queryWrapper);
    }

    public User queryUserByUserId(Long id) {
        QueryWrapper<User> queryWrapper = new QueryWrapper<>();
        queryWrapper.eq("id", id);
        return userMapper.selectOne(queryWrapper);
    }

    public Integer queryUserCount() {
        return userMapper.selectCount(new QueryWrapper<>());
    }


}
